import random
opcode = ['+', '-', '*', '/']
sum=0
right = 0
wrong = 0
exit=0
while exit==0:
    flag = random.choice(opcode)
    a = random.randint(1,100)
    b = random.randint(1,100)
    if flag == "+":
        result = a+b
    elif flag == "-":
        result =a - b
    elif flag == "*":
        result =a * b
    else:
        result =a / b
    print("聪明的小朋友请听题:")
    print("题目:",str(a) + flag +str(b) + "=?")
    answer = int(input("请输入你的答案："))
    if result ==answer :
        print("太棒了，答对了")
        right+=1
    else:
        print("真遗憾，打错了，再答一次，你是最棒的！")
        wrong+=1
    sum=right+wrong
    exit = int(input("是否需要继续？（输入0:继续/输入1：退出）"))
print("正确率：" + str(right/sum) + "错误率" + str(wrong/sum))